import notifyRequest from '@/utils/notifyRequest';
import { ArticleInfo, Channel } from '@/type/NotifyType';
import { ResponseType } from '@/type/ResponseType';


enum Enum {
  fetchChannelsListAPI = '/channels',
  fetchArticlesListAPI = '/articles'
}

/**
 * 获取-所有频道列表的接口
 * */
export const fetchChannelsListAPI = () => notifyRequest.get<{ channels: Channel[] }, ResponseType<{ channels: Channel[] }>>(Enum.fetchChannelsListAPI);


/**
 * 获取文章列表的接口
 * */
export const fetchArticlesListAPI = (channel_id: string, timestamp: string) => notifyRequest.get<ArticleInfo, ResponseType<ArticleInfo>>(Enum.fetchArticlesListAPI, {
  params: {
    channel_id,
    timestamp,
  },
});